In object-oriented programming, it is desirable that all the members of a class should be related to each other and less dependent on members of other classes in the program. The former property of an object-oriented program is referred to as ‘cohesion’, while the latter is referred to as ‘coupling.’ However, it has been observed by researchers that the above properties, namely high cohesion and low coupling, are not really satisfied by many object-oriented programs in practice. It is important that object-oriented programs satisfy these properties as maintenance and defect detection can become simpler.
Presently, refactoring tools and methods axe known that rely on the user guiding the tool by suggesting explicitly the members of classes to be moved to chosen destination classes, so that the resulting classes may be more cohesive and exhibit less coupling. The refactoring tools provide an automated capability to carry out refactorings such as Move Method or Move Attribute (or field) on the input classes only when the user specifies which method or attribute should be moved from a given source class to a destination class.
For example, the article Simon, F. Steinbruckner, and C. Lewerentz, “Metrics Based Refactoring”, Proc. 5th European Conference on Software Maintenance and Reengineering, pages 30-38, IEEE, Los Alamitos, 2001, describes a metrics based refactoring approach.